<?php

    class countdownmodule_config {
        function form($object) {
            if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
            exponent_forms_initialize();

            $form = new form();
            if (!isset($object->id)) {
                // set default config 
                // skin size
                $object->width=100;
                $object->height=100;
                // size of flash control inside
                $object->control_width=100;
                $object->control_height=100;
                // flash var config
                $object->eventDate=time(); // current date
                $object->daysColor="cccccc";
                $object->hoursColor="fe2309";
                $object->minutesColor="82ca9c";
                $object->secondsColor="c69c6d";
                $object->skin_fileid=0;
                $object->url='';
            } else {
                $form->meta('id',$object->id);
            }

            $form->register('width','Skin Width',new textcontrol($object->width,50,false,200));
            $form->register('height','Skin Height',new textcontrol($object->height,50,false,200));
            
            $form->register('control_width','Control Width',new textcontrol($object->control_width,50,false,200));
            $form->register('control_height','Control Height',new textcontrol($object->control_height,50,false,200));
            
            $form->register('eventDate','Event Date',new yuidatetimecontrol($object->eventDate,'', true, false, false, false));
            $form->register("daysColor","Day color",new colorpicker($object->daysColor));
            $form->register("hoursColor","Hours color",new colorpicker($object->hoursColor));
            $form->register("minutesColor","Minutes color",new colorpicker($object->minutesColor));
            $form->register("secondsColor","Seconds color",new colorpicker($object->secondsColor));
            $form->register('skin_fileid','Skin Picture', new ajax_select_file("skin_fileid",0,$object->skin_fileid,true));
            
            $form->register('url','Link to URL',new textcontrol($object->url,50,false,200));
            $form->register('submit','',new buttongroupcontrol('Save','','Cancel'));
            return $form;
        }

        function update($values,$object) {
            $object->width=intval($values['width']);
            $object->height=intval($values['height']);
            // size of flash control inside
            $object->control_width=intval($values['control_width']);
            $object->control_height=intval($values['control_height']);
            // flash var config
            //$object->eventDate=
            $object->eventDate = yuidatetimecontrol::parseData('eventDate',$values);
            $object->daysColor=$values['daysColor'];
            $object->hoursColor=$values['hoursColor'];
            $object->minutesColor=$values['minutesColor'];
            $object->secondsColor=$values['secondsColor'];
            $object->skin_fileid=$values['skin_fileid'];
            $object->url=$values['url'];
            return $object;
        }
    }

?>